#!/usr/bin/env python
#coding=utf-8
import interface_module

def addList(url, list, account):
	loginuser = interface_module.login(url, account)
	#	self.keys.append("session:"+loginuser["token"])
	create_list1_headers = {
		"token": loginuser["token"]
	}
	interface_module.ideCreateCloudList(url, create_list1_headers, list)
	result = {
		"token" : loginuser["token"],
		"uid" : loginuser["uid"]
	}
	return result

def postDatatoListIDE(url, list, account, data):
	loginuser = interface_module.login(url, account)
	#ide post data to list1
	post_cloudlist_header = {
		"token": loginuser["token"]
	}
	post_cloudlist_data = {}

	for v in data:
		post_cloudlist_data = {
			"listName" : list["listName"],
			"data" : v
		}
		interface_module.idePostCloudList(url, post_cloudlist_header, post_cloudlist_data)

def registerMoes(url, account, meos):
	loginuser = interface_module.login(url, account)
	#	self.keys.append("session:"+loginuser["token"])
	create_list1_headers = {
		"token": loginuser["token"]
	}
	# registe meos1 to user
	register_header = {
		"token": loginuser["token"],
		"devicetype": meos["devicetype"], 
		"deviceid": meos["deviceid"]
	}
	register_response = interface_module.registermEos(url, register_header)
	result = {
		"token" : loginuser["token"],
		"uid" : loginuser["uid"]
	}
	return result